package com.bionic.ce.beans;

import java.io.Serializable;
import java.util.Date;

public class Query implements Serializable {

    protected Integer queryId;
    protected Integer openByUser;
    protected Date openDate;
    protected Date finishDate;
    protected Double amount;
    protected String currencyFrom;
    protected String currencyTo;
    protected Double rateFrom;
    protected Double rateTo;
    protected String status;
    protected Integer executedByUser;
    protected Double closedRate;
    protected Date closedDate;
    
    

    public Query() {
    }

    public Query(Integer queryId, Date openDate, Date finishDate, Double amount,
            String currencyFrom, String currencyTo, Double rateFrom,
            Double rateTo, String status, Integer openByUser) {
        this.queryId = queryId;
        this.openDate = openDate;
        this.finishDate = finishDate;
        this.amount = amount;
        this.currencyFrom = currencyFrom;
        this.currencyTo = currencyTo;
        this.rateFrom = rateFrom;
        this.rateTo = rateTo;
        this.status = status;
        this.openByUser = openByUser;
    }

    public Integer getOpenByUser() {
        return openByUser;
    }

    public void setOpenByUser(Integer openByUser) {
        this.openByUser = openByUser;
    }

    public Integer getExecutedByUser() {
        return executedByUser;
    }

    public void setExecutedByUser(Integer executedByUser) {
        this.executedByUser = executedByUser;
    }

    public Double getClosedRate() {
        return closedRate;
    }

    public void setClosedRate(Double closedRate) {
        this.closedRate = closedRate;
    }

    public Date getClosedDate() {
        return closedDate;
    }

    public void setClosedDate(Date closedDate) {
        this.closedDate = closedDate;
    }

    public Integer getQueryId() {
        return queryId;
    }

    public void setQueryId(Integer queryId) {
        this.queryId = queryId;
    }

    public Date getOpenDate() {
        return openDate;
    }

    public void setOpenDate(Date openDate) {
        this.openDate = openDate;
    }

    public Date getFinishDate() {
        return finishDate;
    }

    public void setFinishDate(Date finishDate) {
        this.finishDate = finishDate;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public String getCurrencyFrom() {
        return currencyFrom;
    }

    public void setCurrencyFrom(String currencyFrom) {
        this.currencyFrom = currencyFrom;
    }

    public String getCurrencyTo() {
        return currencyTo;
    }

    public void setCurrencyTo(String currencyTo) {
        this.currencyTo = currencyTo;
    }

    public Double getRateFrom() {
        return rateFrom;
    }

    public void setRateFrom(Double rateFrom) {
        this.rateFrom = rateFrom;
    }

    public Double getRateTo() {
        return rateTo;
    }

    public void setRateTo(Double rateTo) {
        this.rateTo = rateTo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Query [queryId=" + getQueryId() + ", openDate=" + getOpenDate()
                + ", finishDate=" + getFinishDate() + ", amount=" + getAmount()
                + ", currencyFrom=" + getCurrencyFrom() + ", currencyTo="
                + getCurrencyTo() + ", rateFrom=" + getRateFrom() + ", rateTo=" + getRateTo()
                + ", status=" + getStatus() + ", openByUser=" + getOpenByUser() + 
                ", executedByUser=" + getExecutedByUser() +", closedRate=" + getClosedRate() +
                ", closedDate=" + getClosedDate() +"]";
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
		result = prime * result
				+ ((getCurrencyFrom() == null) ? 0 : getCurrencyFrom().hashCode());
		result = prime * result
				+ ((getCurrencyTo() == null) ? 0 : getCurrencyTo().hashCode());
		result = prime * result
				+ ((getFinishDate() == null) ? 0 : getFinishDate().hashCode());
		result = prime * result
				+ ((getOpenDate() == null) ? 0 : getOpenDate().hashCode());
		result = prime * result + getQueryId();
		long temp;
		temp = Double.doubleToLongBits(getRateFrom());
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(getRateTo());
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
		result = prime * result + ((getOpenByUser() == null) ? 0 : getOpenByUser().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Query))
			return false;
		Query other = (Query) obj;
		if (getAmount() == null) {
			if (other.getAmount() != null)
				return false;
		} else if (!amount.equals(other.amount))
			return false;
		if (getCurrencyFrom() == null) {
			if (other.getCurrencyFrom() != null)
				return false;
		} else if (!currencyFrom.equals(other.currencyFrom))
			return false;
		if (getCurrencyTo() == null) {
			if (other.getCurrencyTo() != null)
				return false;
		} else if (!currencyTo.equals(other.currencyTo))
			return false;
		if (getFinishDate() == null) {
			if (other.getFinishDate() != null)
				return false;
		} else if (!finishDate.equals(other.finishDate))
			return false;
		if (getOpenDate() == null) {
			if (other.getOpenDate() != null)
				return false;
		} else if (!openDate.equals(other.openDate))
			return false;
		if (getQueryId() != other.getQueryId())
			return false;
		if (Double.doubleToLongBits(getRateFrom()) != Double
				.doubleToLongBits(other.getRateFrom()))
			return false;
		if (Double.doubleToLongBits(getRateTo()) != Double
				.doubleToLongBits(other.getRateTo()))
			return false;
		if (getStatus() == null) {
			if (other.getStatus() != null)
				return false;
		} else if (!status.equals(other.status))
			return false;
		if (getOpenByUser() == null) {
			if (other.getOpenByUser() != null)
				return false;
		} else if (!openByUser.equals(other.openByUser))
			return false;
		return true;
	}
}
